package com.gree.elasticsearch.util;

import com.gree.elasticsearch.dto.Result;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;


public class ResponseUtil {
    public static  Result success() {
        return success( "ok", "");
    }

    public static Result success(Object data, String message) {
        return success(200, data, "");
    }


    public static Result success(Object data) {
        return success(data, "");
    }

    public static Result unAuthentication() {
        return buildResult(HttpStatus.UNAUTHORIZED.value(), "", "please login");
    }

    public static Result unAuthorized() {
        return buildResult(HttpStatus.FORBIDDEN.value(), "", "deny access");
    }

    public static Result success(Integer code, Object data, String message) {
        return buildResult(code, data, message);
    }

    public static Result buildResult(Integer code, Object data, String message) {
        return new Result(code, data, message);
    }

}
